package co.za.alicrity.exactcover;

import java.util.List;
import java.util.Random;

import co.za.alacrity.factorypattern.DlxFactory;
import co.za.alacrity.factorypattern.ExFactory;
import co.za.alacrity.suduko.SudokuGame;

public class testMatrix2 extends ExactCoverMatrix {
	
	boolean[][] m = new boolean[1800][];
	
	public testMatrix2(){
		
		Random random = new Random();
		
		for (int r=0;r<m.length;r++){
			m[r] = new boolean[300];
			for (int k=0;k<m[r].length;k++){
				m[r][k] = random.nextBoolean();
			}
		}
	}

	@Override
	public boolean getAt(int row, int col) {
		return m[row][col];
	}

	@Override
	public int getRows() {
		return m.length;
	}

	@Override
	public int getCols() {
		return m[0].length;
	}
	
	public static void main(String args[]){
		//System.out.println(new ExactCoverSparceMatrix(new testMatrix()).toString());
		
		
		
		//System.out.println(new ExactCoverSparceMatrix(new testMatrix2()).toString());
		//System.out.println(new TreeNodes(new ExactCoverSparceMatrix(new testMatrix2()), null,0,s).toString());
		
		//System.out.println(s);
		
		int [][] z = new int[9][];
		for (int r=0;r<9;r++){
			z[r] = new int[9];
			for (int k=0;k<9;k++){
				z[r][k]=0;
			}
		}
		
		z[0][6]=6;
		z[0][7]=8;
		z[1][4]=7;
		z[1][5]=3;
		z[1][8]=9;
		z[2][0]=3;
		z[2][2]=9;
		z[2][7]=4;
		z[2][8]=5;
		z[3][0]=4;
		z[3][1]=9;
		z[4][0]=8;
		z[4][2]=3;
		z[4][4]=5;
		z[4][6]=9;
		z[4][8]=2;
		z[5][7]=3;
		z[5][8]=6;
		z[6][0]=9;
		z[6][1]=6;
		z[6][6]=3;
		z[6][8]=8;
		z[7][0]=7;
		z[7][3]=6;
		z[7][4]=8;
		z[8][1]=2;
		z[8][2]=8;
		
		SudokuGame t = new SudokuGame(z);
		System.out.println(t);
		System.out.println();
		ExFactory.instance.getSolver().solve(t);
		System.out.println(t);
	}

	@Override
	public void applySolution(List<Integer> rowNumbers) {
		// TODO Auto-generated method stub
		
	}

}
